unit uIntfObject_Impl;

interface

uses
  Windows;

type
  TIntfObject = class(TObject, IInterface)
  private
    FRefCount: Integer;
  public
    function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
    function _AddRef: Integer; stdcall;
    function _Release: Integer; stdcall;
  end;


implementation

{
********************************* TIntfObject **********************************
}
function TIntfObject.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
  if GetInterface(IID, Obj) then
    Result := 0
  else
    Result := E_NOINTERFACE;
end;

function TIntfObject._AddRef: Integer;
begin
  Result := InterlockedIncrement(FRefCount);
end;

function TIntfObject._Release: Integer;
begin
  Result := InterlockedDecrement(FRefCount);
end;



end.
